package com.example.orderapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.example.orderapplication.bean.DataX
import com.google.gson.Gson

class DetailsActivity : AppCompatActivity() {
    var data: DataX? = null
    val TAG = "DetailsActivitys"
    private val mItemAlbum: ImageView by lazy { findViewById(R.id.item_album) }
    private val mItemHomeName: TextView by lazy { findViewById(R.id.item_home_name) }
    private val mTvPrice: TextView by lazy { findViewById(R.id.tv_price) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_details)
        data = intent.getSerializableExtra("DataX") as DataX
        Log.e(TAG, Gson().toJson(data))

        Glide.with(this)
            .load(data!!.imgURL)
            .placeholder(R.drawable.ic_launcher_background)
            .into(mItemAlbum)
        mItemHomeName.text = data!!.title
        mTvPrice.text = data!!.desc
    }
}